Lesson 0006 · ~15 min

Self-attention: queries, keys, values

Core idea: Each token produces a query, keys decide matches, values carry content, and masking limits which tokens can be attended to.

What to remember

Why it matters

This is the internal shape of attention, not just the surface intuition.

Mental model

  1. Take one token’s query
  2. Compare to allowed keys
  3. Get relevance weights
  4. Mix the corresponding values

Checkpoint

  1. What job does the mask do?
  2. Why split keys from values?
  3. Why can’t a causal model attend to future tokens?